package org.hbbTlias2025.mapper;

import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.hbbTlias2025.pojo.Emp;
import org.hbbTlias2025.pojo.EmpQueryParam;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
//    @Select("SELECT emp.*, dept.name as deptName from emp left join dept on emp.dept_id = dept.id ORDER BY emp.update_time DESC")
//    List<Emp> findAll();

//    @Select("SELECT emp.*, dept.name as deptName from emp left join dept on emp.dept_id = dept.id " +
//            "WHERE emp.name like '%#{name}%' and emp.gender = #{gender} and entry_date between #{begin} and #{end} " +
//            "order by emp.update_time DESC")
    List<Emp> findAll(EmpQueryParam empQueryParam);

//    @Options(useGeneratedKeys = true, keyProperty = "id")
    int addOne(Emp emp);

    void deleteIds(List<Integer> ids);

    Emp findOne(Integer id);

    void updateOne(Emp emp);

    @MapKey("pos")
    List<Map<String, Object>> getEmpJobData();

    @MapKey("name")
    List<Map<String, Object>> getEmpGenderData();

    List<Emp> getAllEmpName();

    Emp selectByUserNameAndPassword(Emp emp);
}
